#include<iostream>
#include<vector>
using namespace std;
#define MAX(X,Y) X>Y?X:Y
#define MIN(X,Y) X<Y?X:Y
#define N 9
static int Min[N],Max[N],a[N] = {6,9,-1,4,-8,5,3,7,-100};
int max_val=-10000;

void maxsub_product(){
    int x,y,i,t,index;
    vector<int> vec;
    index = 0;
    Max[0] = Min[0] = a[0];
    for(i=1;i<N;i++){
        x = MAX(Max[i-1]*a[i],Min[i-1]*a[i]);
        y = MIN(Max[i-1]*a[i],Min[i-1]*a[i]);
        Max[i] = MAX(x,a[i]);
        Min[i] = MIN(y,a[i]);
        if(Max[i] > max_val){
            max_val = Max[i];
            index = i;
        }
    }
    printf("%d\n",max_val);
    if(max_val == 0){
        printf("%d\n",index);
        return;
    }
    t = max_val;
    while( index && t != 1){
        vec.push_back(index);
        t /= a[index--];
    }
    while(!vec.empty()){
        printf("%d ",vec.back());
        vec.pop_back();
    }
    printf("\n");
    return;
}

int main(){
    maxsub_product();
    return 0;
}
